package com.example.ivory.accountbook.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.TextView;

import com.example.ivory.accountbook.Activity.Alert;
import com.example.ivory.accountbook.Activity.Export_data;
import com.example.ivory.accountbook.Activity.Set;
import com.example.ivory.accountbook.Activity.person_data;
import com.example.ivory.accountbook.R;
import com.example.ivory.accountbook.uilt.TittleManager;


/**
 * Created by Ivory on 2016/8/27.
 */
public class Fragment_me extends basefragment implements View.OnClickListener {
    private View mContent;
    private TittleManager tittleManager;
    private ImageButton head_portrait;
    private Button name, introduction;
    private TextView export_data,alert, set, about_us;
    private Intent personal;

    @Override
    protected View initView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        mContent = inflater.inflate(R.layout.fragment_me, container, false);

        tittleManager=new TittleManager(mContent);
        tittleManager.setTitleStyle(TittleManager.TitleStyle.ONLY_TITLE,"我");

        head_portrait = (ImageButton) mContent.findViewById(R.id.head_portrait);
        name = (Button) mContent.findViewById(R.id.name);
        introduction = (Button) mContent.findViewById(R.id.introduction);
        export_data = (TextView) mContent.findViewById(R.id.export_data);
        alert = (TextView) mContent.findViewById(R.id.alert);
        set = (TextView) mContent.findViewById(R.id.set);
        about_us = (TextView) mContent.findViewById(R.id.about_us);

        personal=new Intent(mActivity,person_data.class);
        return mContent;
    }

    @Override
    protected void initData() {
        super.initData();
    }

    @Override
    protected void initEvent() {
        head_portrait.setOnClickListener(this);
        name.setOnClickListener(this);
        introduction.setOnClickListener(this);
        export_data.setOnClickListener(this);
        alert.setOnClickListener(this);
        set.setOnClickListener(this);
        about_us.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.head_portrait:
                startActivity(personal);
                break;
            case R.id.name:
                startActivity(personal);
                break;
            case R.id.introduction:
                startActivity(personal);
                break;
            case R.id.export_data:
              //  Toast.makeText(mActivity,"导出数据",Toast.LENGTH_LONG).show();
                Intent ex_data=new Intent(mActivity,Export_data.class);
                startActivity(ex_data);
                break;
            case R.id.alert:
            //    Toast.makeText(mActivity,"提醒",Toast.LENGTH_LONG).show();
                Intent set_alert=new Intent(mActivity,Alert.class);
                startActivity(set_alert);
                break;
            case R.id.set:
              //  Toast.makeText(mActivity,"设置",Toast.LENGTH_LONG).show();
                Intent me_set=new Intent(mActivity,Set.class);
                startActivity(me_set);
                break;
            case R.id.about_us:
                break;


        }
    }
}